package com.ruoyi.web.ydz.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.web.ydz.domain.PointsRule;
import com.ruoyi.web.ydz.mapper.PointsRuleMapper;
import com.ruoyi.web.ydz.service.IPointsRuleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 积分产生规则Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-22
 */
@Service
public class PointsRuleServiceImpl implements IPointsRuleService
{
    @Resource
    private PointsRuleMapper pointsRuleMapper;

    /**
     * 查询积分产生规则
     * 
     * @param id 积分产生规则主键
     * @return 积分产生规则
     */
    @Override
    public PointsRule selectPointsRuleById(Long id)
    {
        return pointsRuleMapper.selectPointsRuleById(id);
    }

    /**
     * 查询积分产生规则列表
     * 
     * @param pointsRule 积分产生规则
     * @return 积分产生规则
     */
    @Override
    public List<PointsRule> selectPointsRuleList(PointsRule pointsRule)
    {
        return pointsRuleMapper.selectPointsRuleList(pointsRule);
    }

    /**
     * 新增积分产生规则
     * 
     * @param pointsRule 积分产生规则
     * @return 结果
     */
    @Override
    public int insertPointsRule(PointsRule pointsRule)
    {
        pointsRule.setCreateTime(DateUtils.getNowDate());
        return pointsRuleMapper.insertPointsRule(pointsRule);
    }

    /**
     * 修改积分产生规则
     * 
     * @param pointsRule 积分产生规则
     * @return 结果
     */
    @Override
    public int updatePointsRule(PointsRule pointsRule)
    {
        pointsRule.setUpdateTime(DateUtils.getNowDate());
        return pointsRuleMapper.updatePointsRule(pointsRule);
    }

    /**
     * 批量删除积分产生规则
     * 
     * @param ids 需要删除的积分产生规则主键
     * @return 结果
     */
    @Override
    public int deletePointsRuleByIds(Long[] ids)
    {
        return pointsRuleMapper.deletePointsRuleByIds(ids);
    }

    /**
     * 删除积分产生规则信息
     * 
     * @param id 积分产生规则主键
     * @return 结果
     */
    @Override
    public int deletePointsRuleById(Long id)
    {
        return pointsRuleMapper.deletePointsRuleById(id);
    }
}
